﻿@{
    var theme = ViewContext.HttpContext.Request.Cookies[".theme"];
    var themeClass = theme == "dark" ? "sl-theme-dark netnrmd-dark" : "sl-theme-light netnrmd-light";

    var rdv = ViewContext.RouteData.Values;
    var ctrl = rdv["controller"].ToString().ToLower();
    var actionName = rdv["action"].ToString().ToLower();
    var ca = ctrl + "/" + actionName;

    var canav = "account/,mix/terms".Split(',');
    var cafooter = "account/,admin/,home/completeinfo,home/write,storage/,ss/,user/write,user/message,user/verify,user/setting,mix/terms,note/,run/index,run/code,gist/index,gist/code,draw/index,draw/code,doc/index,doc/form,doc/item,doc/catalog,guff/code,guff/index".Split(',');

    if (ctrl == "ss")
    {
        var navs = ScriptService.NavArray;
        var item = ScriptService.Find(actionName);
        if (item != null)
        {
            ViewData["Title"] = $"{item.GetValue("title")}";
        }
    }
}
@Html.Raw(QuoteTo.Html("the"))
<!DOCTYPE html>
<html lang="zh-cn" class='@themeClass'>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    @if (ctrl == "run")
    {
        <meta name='keywords' content='NET牛人,Netnr,Run,在线javascript代码编辑器,js代码在线测试调试,js在线运行工具,html,css,jquery,runjs类似,jsrun类似,jsfiddle国内类似' />
        <meta name='description' content='NET牛人,Netnr,在线编写、展示html、js、css代码，拥有实时预览、分享、代码高亮、自动完成等多项特性' />
    }
    else if (ctrl == "guff")
    {
        <meta name="referrer" content="never">
        <meta name='keywords' content='NET牛人,Netnr,Guff,尬服,尬服乐天地' />
        <meta name='description' content='NET牛人,Netnr,Guff,尬服,尬服乐天地' />
    }
    else if (ctrl == "ss")
    {
        var navs = ScriptService.NavArray;
        var item = ScriptService.Find(actionName);
        if (item != null)
        {
            var title = item.GetValue("title");
            var remark = item.GetValue("remark") ?? title;
            ViewData["Title"] = title;

            <meta name='keywords' content='NET牛人,Netnr,@Html.Raw(title)' />
            <meta name='description' content='NET牛人,Netnr,脚本服务,Script Services,工具箱,@Html.Raw(remark)' />
        }
        else
        {
            ViewData["Title"] = "脚本服务";

            <meta name='keywords' content='NET牛人,Netnr,脚本服务' />
            <meta name='description' content='NET牛人,Netnr,脚本服务,Script Services,工具箱' />
        }
    }
    else
    {
        <meta name='keywords' content='NET牛人,Netnr,Gist,Run,Doc,Draw' />
        <meta name='description' content='NET牛人,Netnr,Gist,Run,Doc,Draw' />
    }

    <title>@ViewData["Title"] @Html.Raw(AppTo.GetValue("Common:ChineseName"))</title>

    @Html.Raw(QuoteTo.Html($"favicon,bootstrap5.css"))
    <link href="/app/blog/dist/all.css" rel="stylesheet" asp-append-version="true" />
    <script src="/app/blog/dist/all.js" asp-append-version="true"></script>
</head>
<body>
    @if (!canav.Any(x => ca.StartsWith(x)))
    {
        if (AppTo.GetValue<bool>("ReadOnly"))
        {
            var myDomain = AppTo.GetValue("Common:Domain");

            <div class="p-2 text-center">Mirror site is read only <a href="@myDomain">@(new Uri(myDomain).Host)</a></div>
        }
        <partial name="_PartialNav" />
    }
    @RenderBody()
    @if (ctrl == "ss")
    {
        var ownjs = $"/js/{ca}.js";
        if (File.Exists(AppTo.WebRootPath + ownjs))
        {
            <script src="@ownjs" asp-append-version="true"></script>
        }
    }
    @if (!cafooter.Any(x => ca.StartsWith(x)))
    {
        <partial name="_PartialFooter" />
    }
</body>
</html>